package com.xinqi.modules.course.chapter.mapper;

import com.xinqi.common.mybatis.data.repo.SuperMapper;
import com.xinqi.modules.course.chapter.domain.CourseChapterEntity;
import com.xinqi.modules.course.chapter.dto.req.ChapterQueryDTO;
import com.xinqi.modules.course.chapter.param.ChapterResponseDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 课程章节表(CourseChapter)表数据库访问层
 *
 * @author liuxingxing
 * @since 2023-03-08 10:10:42
 */
@Mapper
public interface CourseChapterMapper extends SuperMapper<CourseChapterEntity> {

    List<ChapterResponseDTO> selectChapterOrSonChapter(@Param("queryParam") ChapterQueryDTO queryParam);

    void removeByPid(@Param("idList") List<Long> idList);

    List<String> getChapterName(Long id);

    Map<String, Object> chapterCount(@Param("classId") Long classId);

    Integer chapterSonMaxSort(@Param("classId") Long classId, @Param("pid") Long pid);

    Integer chapterParMaxSort(@Param("classId") Long classId);

    List<CourseChapterEntity> chapterMaxSortList(@Param("classIds") List<Long> classIds);

    List<CourseChapterEntity> findMaxSortGroupByClassId(@Param("classIdList") List<Long> classIdList);

    String selectChapterNameById(@Param("id") Long id);

    /**
     * 查询父级ID结合
     *
     * @param id
     * @return
     */
    String selectParentIds(@Param("id") Long id);


}
